﻿<?php 
header ( "Content-type: text/html; charset=utf-8" );
$rights = explode(',', $role['MENUS']); 
$actions = explode(',',$role['ACTIONS']); 
$submenus = $menus['menus'];
foreach($submenus as $key=>$menu){
	if (!in_array($key, $rights) && CSM_UNIT_ID>0) continue;
	if($menu['url']!=""){
	?>	
	 <dt><a href="<?php echo $menu['url']?>" target="fmMainContents"><?php echo $menu['title'];?></a></dt>
	<?php }else{ ?>
	<dt><a href="javascript:;"><?php echo $menu['title'];?></a></dt>
	<?php } ?>
	<dd class="show"><ul>
		<?php 
		if($menu['url']=="" && count($menu['forms'])>0){
			if (is_array($menu['forms'])) {
			foreach($menu['forms'] as $fid=>$form){
      			if (!in_array($fid, $actions) && CSM_UNIT_ID>0) continue;
      			$url = ($form['url']) ? $form['url'] : "index.php?c=".$form['controller']."&a=".$form['action'];
    	?>
    	<li><a href="<?php echo $url?>" target="fmMainContents"><?php echo $form['title']?></a></li>
       <?php }}}?>    
     </ul></dd> 
   <?php }?>

